package com.meetup.service;

import javax.persistence.EntityManager;

import org.hibernate.Session;
import org.hibernate.Criteria;

import com.meetup.domain.ListMeetUpGroup;
import com.meetup.domain.MeetUpGroup;
import org.hibernate.transform.DistinctRootEntityResultTransformer;

public class MeetUpServiceImpl implements MeetUpService {
	private EntityManager em;

	@SuppressWarnings("unchecked")
	public ListMeetUpGroup retrieveGroup() {
		Session sess = (Session) em.getDelegate();
		Criteria criteria = sess.createCriteria(MeetUpGroup.class,
				"meetupGroup");
		return (ListMeetUpGroup) criteria.setResultTransformer(
				DistinctRootEntityResultTransformer.INSTANCE).list();

	}
}
